<?php
use app\assets\AppAsset;
use yii\helpers\Html;
use yii\helpers\Url;
AppAsset::register($this);
$this->registerCssFile('@web/css/sqspeak.css',['depends'=>['app\assets\AppAsset']]);
$this->registerJSFile('@web/js/time.js',['depends'=>['app\assets\AppAsset']]);
$this->registerJSFile('@web/js/speakcum.js',['depends'=>['app\assets\AppAsset']]);

?>
<script type="text/javascript">
	<?php
	$session=Yii::$app->session;
	$session->open();
	?>
	var current_userid=<?=$session['user_id'];?>;
	var que_info={
		class1:'<?=$speak_content['class1_id'];?>',
		class2:'<?=$speak_content['class2_id'];?>',
		question:'<?=$speak_content['id'];?>',
		tnum:'<?=$speak_content['hear_number'];?>'};
	<?php
	if($speak_person)
	{
	?>
	var usercomment="文章主题 : <?php if($speak_person['readtheme']=='null') echo ''; else echo $speak_person['readtheme'];?><br>1. <?php if($speak_person['readhand1']=='null') echo '';else echo $speak_person['readhand1'];?><br>2. <?php if($speak_person['readhand2']=='null') echo '';else echo $speak_person['readhand2'];?><br>语音主题 : <?php if($speak_person['listentheme']=='null') echo '';else echo $speak_person['listentheme'];?><br>1. <?php if($speak_person['listenhand1']=='null') echo ''; else echo $speak_person['listenhand1'];?><br>2. <?php if($speak_person['listenhand2']=='null') echo ''; else echo $speak_person['listenhand2'];?><br>本次练习中，我解决的问题，学会的方法有:<br>"
	<?php
	}
	else
	{
	?>
	var usercomment="本次练习中，我解决的问题，学会的方法有:"
	<?php
	}
	?>
</script>
<div class="container">
	<div class="total-info">
			<span><?=strtoupper($class2_id['name']);?>-<?= $speak_content['hear_number']; ?> Question <?= $speak_content['question_number']; ?></span>
	</div>
	<div class="total-part">
		<div class="total-lead clearfix">
			<span class="top-que pull-left">
			<span><?=strtoupper($class2_id['name']);?>-<?= $speak_content['hear_number']; ?> Question <?= $speak_content['question_number']; ?></span>
			</span>
			<span class="time pull-left">
					<?php
					$session=Yii::$app->session;
					$session->open();
					$session['begin_time'];
					$now=time();
					$session['begin_end_time']=$now-$session['begin_time'];
					if($speak_person)
					{
					?>
				练习耗时: <span id="cost-time"><?=$speak_person['time'];?></span>
				</span>
			<?php
			}
			if($speak_person) {
			?>
			<span class="repeat-doit pull-right"><i class="fa fa-rotate-left"></i>&nbsp;&nbsp;
				<a href="<?= Url::to('@web/?r=speaking/index&id=' . $speak_id); ?>">重做本篇</a>
			</span>
				<?php
			}
			?>
		</div>
		<div class="main-part clearfix">
			<div class="col-xs-5 users">
				<div class="player1">
					<div class="audio">
						<div class="audio-play">
							<div class="audio-control clearfix">
								<div class="pause-play pull-left">
									<span><i class="fa fa-play"></i></span>
								</div>
								<div class="audio-time pull-left clearfix">
									<div class="start-time pull-left">00:00</div>
									<div class="play-line pull-left">
										<div class="play-current-line"></div>
										<div class="play-point"></div>
									</div>
									<div class="end-time pull-left">14:00</div>
								</div>
								<div class="audio-volume pull-left clearfix">
									<div class="volume-icon pull-left">
										<span><img src="<?=Url::to('@web/images/6.png');?>"></span>
									</div>
									<div class="volume-line pull-left">
										<div class="volume-current-line"></div>
										<div class="volume-point"></div>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
				<?php
				if($speak_person) {
					?>
					<div class="user-gain clearfix">
						<div class="my-record clearfix">
							<span>我的题解</span>
							<span class="user-currecord pull-right"><img src="<?=Url::to('@web/images/xx.jpg');?>" alt="你的录音"><audio src="<?=Url::to('@web/audio/user_voice/'.md5("speaking_{$session['user_id']}_{$speak_id}").".wav");?>"></audio></span>
							<span id="userpic" class="pull-right"><img src="<?=$session['photo'];?>"></span>
						</div>
						<div class="record-text">
							<div id="user-comments" contenteditable="true"></div>
						</div>
						<div class="share-wrap clearfix">	
							<div class="share pull-right">
								分享 <span>Share</span>
							</div>
						</div>
						<div id="comment-succeed">
							<img src="<?=Url::to('@web/images/updating.gif');?>" alt="上传中...">
							<span>updating...</span>
						</div>
					</div>
					<?php
				}
				?>
				<div class="hot-voice">
					<div class="hot-lead">热门声音</div>
					<div class="add-more">
						<span>加载更多</span>
					</div>
				</div>
			</div>
			<div class="col-xs-7 ques">
				<div class="player2">
					<div class="audio">
						<div class="audio-play">
							<div class="audio-img">
								<img src="<?=$speak_content['img_url'];?>">
							</div>
							<div class="audio-control clearfix">
								<div class="pause-play pull-left">
									<span><i class="fa fa-play"></i></span>
								</div>
								<div class="audio-time pull-left clearfix">
									<div class="start-time pull-left">00:00</div>
									<div class="play-line pull-left">
										<div class="play-current-line"></div>
										<div class="play-point"></div>
									</div>
									<div class="end-time pull-left">14:00</div>
								</div>
								<div class="audio-volume pull-left clearfix">
									<div class="volume-icon pull-left">
										<span><img src="<?=Url::to('@web/images/6.png');?>"></span>
									</div>
									<div class="volume-line pull-left">
										<div class="volume-current-line"></div>
										<div class="volume-point"></div>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
				<div class="listen-text">
					<div class="text-head clearfix">
						<div class="text-info pull-right">听力原文</div>
						<div class="text-article getNow pull-left">题目文章</div>
					</div>
					<div class="text-wrap"  id="text_wrap">
						<?php
							if ($speak_content['reading_content']) {
								?>
								<p class="text-title"><?= $speak_content['reading_title']; ?></p>
								<span class="text-main">
							<?= $speak_content['reading_content']; ?>
						</span>
								<?php
							} else {
								?>
								<span class="text-main">
								
						</span>
								<?php
							}
						?>
					</div>
					<div class="listen-wrap" id="listen_wrap">
						<?php
							if ($speak_content['listening_content']) {
								?>
								<p class="text-title">speaking_question<?= $speak_content['question_number']; ?>
									_dialog</p>
								<span class="text-main">
							<?= $speak_content['listening_content']; ?>
						</span>
								<?php
							} else {
								?>
								<span class="listen-main">
								
						</span>
								<?php
							}
						?>
					</div>
				</div>
			</div>
			<audio src="<?= $speak_content['topic_content']; ?>" id="audio1"></audio>
			<audio src="<?= $speak_content['listening_script']; ?>" id="audio2"></audio>
		</div>
	</div>
</div>
<div id="voicemodel" class="hidden">
	<div class="user-lead clearfix">
		<div class="user-info pull-left clearfix">
			<div class="user-pic pull-left">
				<img src="<?=Url::to('@web/images/timg.jpg');?>">
			</div>
			<div class="user-id-date pull-left">
				<span class="user-id"></span><br>
				<span class="user-date"></span>
			</div>
		</div>
		<div class="good-times pull-right" title="点赞量">
			<span><i class="fa fa-thumbs-o-up"></i>&nbsp;&nbsp;<span class="goods"></span></span>
		</div>
		<div class="view-times pull-right" title="播放量">
			<span><i class="fa fa-play-circle"></i>&nbsp;&nbsp;<span class="views"></span></span>
		</div>
	</div>
	<div class="user-record clearfix">
		<div class="play-record pull-left">
			<img src="<?=Url::to('@web/images/xx.jpg');?>" alt="user record">
			<audio src="#"></audio>
		</div>
		<span class="record-sec" class="pull-left"></span>
	</div>
	<div class="user-comments">
	</div>
	<div class="view-all center-block">点击查看全文</div>
</div>
<script type="text/javascript">
	window.onload=function() {
		<?php
		$session=Yii::$app->session;
		$session->open();
		?>
		$('#cost-time').html(secToMin(<?=$speak_person['time']?>));
	};
</script>